package com.rcy.server.filter;

import com.rcy.server.wrapper.InputStreamHttpServletRequestWrapper;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author RuicyWu
 * 重新包装request对象的过滤器
 */
public class InputStreamWrapperFilter extends OncePerRequestFilter {
 
    @Override
    protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException, IOException, ServletException {
        ServletRequest servletRequest = new InputStreamHttpServletRequestWrapper(httpServletRequest);
 
        filterChain.doFilter(servletRequest, httpServletResponse);
    }
}